<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="com.tajlip.*,java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Tom and Jayson Live in Portland</title>
        <link type="text/css" href="style.css" />
    </head>
    <body>
        <h1>Current Comics</h1>

        <table width="100%">
            <tr>
                <td width="40">#</td>
                <td width="300">Date</td>
                <td width="*">Title</td>
                <td width="100">Tags</td>
                <td></td>
            </tr>
            <%
        List<Comic> comics = (List) request.getAttribute("comics");
        for (Comic comic : comics) {
            try {
            %>
            <tr>
                <td><a href="/comic/<%= comic.id%>.html"><%= comic.id%></a></td>
                <td><%= new Date(comic.timestamp)%></td>
                <td><%= comic.title%></td>
                <td><%= comic.tags%></td>
                <td>
                    <form action="/edit.html">
                        <input type="hidden" name="d" value="<%= comic.id%>"/>
                        <input type="submit" value="Delete"/>
                    </form>
                </td>
            </tr>
            <%
            } catch (Exception ex) {
                out.println(ex.getMessage());
            }
        }
            %>
        </table>
    </body>
</html>